package cn.yang.controller;

import cn.yang.domain.Questions;
import cn.yang.domain.UserAnswers;
import cn.yang.service.OptionsService;
import cn.yang.service.QuestionsService;
import cn.yang.service.SummaryService;
import cn.yang.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/questions")
public class QuestionController {

    @Autowired
    private QuestionsService questionService;
    @Autowired
    OptionsService optionsService;
    @Autowired
    private SummaryService summaryService;

    // 获取所有题目
    @GetMapping("/allQuestion")
    public Result getAllQuestions() {
        return Result.success(questionService.getQuestion()) ;
    }
    // 获取某个题目的选项
    @GetMapping("/options/{questionId}")
    public Result getOptionsByQuestionId(@PathVariable Integer questionId) {
        return Result.success(optionsService.getOptionsByQuestionId(questionId));
    }
    @GetMapping("/summary")
    public Result getSummary(){
        return Result.success(summaryService.list());
    }
    @GetMapping("/yzm")
    public Result yzm(){
        System.out.println(3398);
        return Result.success();
    }
}

